import Api from "@/api/setting/banner";
import i18n from "@/lang/index";
const modalConfig = {
  pageName: "sys:user",
  dialog: {
    title: i18n.global.t('title.27'),
    width: 800,
    appendToBody: true,
    draggable: true,
    labelWidth: "auto",
  },
  formAction: (data) => {
    console.log("add", data);
    return new Promise((resolve, reject) => {
      Api.add(data).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        reject(e)
      })
    });
  },

  formItems: [
    {
      type: "upload",
      label: "banner",
      prop: "image",
      attrs: {
        placeholder: i18n.global.t("hint.114"),
        returnType: "path"
      },
      col: {
      }
    },
    {
      type: "select",
      label: i18n.global.t("label.104"),
      prop: "device_type",
      options: [
        { label: 'PC', value: 'pc' },
        { label: 'Mobile', value: 'mobile' },
      ],
      initialValue: 'mobile',
      col: {
        span: 12,
      }
    }, {
      type: "radio",
      label: i18n.global.t("label.105"),
      prop: "visible",
      options: [
        { label: i18n.global.t("status.1"), value: 1 },
        { label: i18n.global.t("status.2"), value: 0 },
      ],
      initialValue: 1,
      col: {
        span: 12,
      }
    }, {
      type: "input",
      label: i18n.global.t("label.80"),
      prop: "title",
      attrs: {
        placeholder: i18n.global.t("hint.82"),
      },
      col: {
        span: 12,
      }
    }, {
      type: "input",
      label: i18n.global.t("label.103"),
      prop: "link",
      attrs: {
        placeholder: i18n.global.t("hint.109"),
      },
      col: {
        span: 12,
      }
    }, {
      type: "date-picker",
      label: i18n.global.t("label.59"),
      prop: "start",
      attrs: {
        placeholder: i18n.global.t("hint.113"),
      },
      col: {
        span: 12,
      }
    }, {
      type: "date-picker",
      label: i18n.global.t("label.60"),
      prop: "end",
      attrs: {
        placeholder: i18n.global.t("hint.81"),
      },
      col: {
        span: 12,
      }
    },
    {
      type: "input",
      label: i18n.global.t("form.12"),
      prop: "order",
      attrs: {
        placeholder: i18n.global.t("hint.24"),
      },
      col: {
        span: 12,
      },
      initialValue: 0,
    },
  ],
  formRules: {
    device_type: [{ required: true, message: '', trigger: "blur" }],
    image: [{ required: true, message: i18n.global.t("hint.114"), trigger: "blur" }],
    order: [{ required: true, message: i18n.global.t("hint.24"), trigger: "blur" }],
  },
};

export default modalConfig;
